package org.example.camundaapp.dto;

import lombok.Data;
import org.camunda.bpm.engine.task.Task;

import java.util.Date;

/**
 * @className: TaskDTO
 * @author: ZHRJ
 * @date: 2025-06-26 11:29
 * @Version: 1.0
 * @description:
 */
@Data
public class TaskDTO implements java.io.Serializable{
    private static final long serialVersionUID = -2268285392508147485L;
    // 任务iD
    private String id;
    // 任务名称
    private String name;
    // 任务处理人
    private String assignee;
    // 任务定义key
    private String taskDefinitionKey;
    // 任务状态
    private int suspensionState;

    // 流程实例id
    private String processInstanceId;
    // 流程定义id
    private String processDefinitionId;
    private Date createTime;

    private String executionId;




    public TaskDTO(Task task) {
        this.id = task.getId();
        this.name = task.getName();
        this.processInstanceId = task.getProcessInstanceId();
        this.createTime = task.getCreateTime();
        this.assignee = task.getAssignee();
        this.suspensionState = task.isSuspended() ? 1 : 0;
        this.executionId = task.getExecutionId();
        this.taskDefinitionKey = task.getTaskDefinitionKey();
        this.processDefinitionId = task.getProcessDefinitionId();

    }
}
